package com.hs.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.entity.Psychological;
import com.hs.mapper.PsychologicalMapper;
import com.hs.service.PsychologicalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.lang.model.element.PackageElement;
import java.util.List;

/**
 * @ClassName PsychologicalServiceimpl
 * @Description TODO
 * @Author wangzhihao
 * @Date 2025年08月08日 21:11
 * @Version 1.0
 */
@Service
public class PsychologicalServiceimpl implements PsychologicalService {
    @Autowired
    PsychologicalMapper psychologicalMapper;
    @Override
    public int insert(Psychological psychological) {
        return psychologicalMapper.insert(psychological);
    }

    @Override
    public int update(Psychological psychological) {
        return psychologicalMapper.update(psychological);
    }

    @Override
    public int delete(int id) {
        return psychologicalMapper.delete(id);
    }

    @Override
    public Psychological select(int id) {
        return psychologicalMapper.select(id);
    }

    @Override
    public PageInfo<Psychological> selectByExample( int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Psychological> psychologicals = psychologicalMapper.selectAll();
        PageInfo<Psychological> pageInfo = new PageInfo<>(psychologicals);
        return pageInfo;
    }
}
